package com.hgq.tenadmin.md.market.controller;

import com.github.pagehelper.PageInfo;
import com.hgq.tenadmin.md.market.service.MdMarketService;
import com.hgq.tencommon.common.R;
import com.hgq.tencommon.entity.md.market.MdMarket;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/md/market")

public class MdMarketController {
    @Resource
    private MdMarketService mdMarketService;
    @GetMapping("/findAllMarket")
    public R findAllMarket(int pageNum,int pageSize,Integer source, Integer follow){
        PageInfo<MdMarket> allMdMarket = mdMarketService.findAllMdMarket(pageNum, pageSize, source, follow);
        return R.ok(allMdMarket);
    }
    @PostMapping("/saveMarket")
    public R saveMarket(@RequestBody MdMarket market){
        mdMarketService.saveOneMarket(market);
        return R.ok();
    }
    @PostMapping("/updateMarket")
    public R updateMarket(@RequestBody MdMarket market){
        mdMarketService.updateOneMarket(market);
        return R.ok();
    }
    @PostMapping("/removeOneMarket")
    public R removeOneMarket( Integer mid){
        mdMarketService.removeOneMarket(mid);
        return R.ok();
    }
}
